#include <stdio.h>
#include <string.h>

int mod_name(char *src, char *des, int num)
{	
	char temp[128] = "";
	int i = 0;
	char *pstr = NULL;

    pstr = strchr(des, '.');

    if (pstr == NULL) {
        printf("pstr is blank\n");
		sprintf(src, "%s", des);
		return -1;
    }

	while (des[i] != '.') {
		temp[i] = des[i];
		i++;
	}

	sprintf(src, "%s-%d.JGP", temp, num);

	return 0;
}

int main(void)
{
	char *des = "/mnt/media/Auto/alpha_1db8d34c9e87/XAGe87_0050.JPG";
	char src[128] = "";
	
	mod_name(src, des, 1);
	printf("%s\n", src);

	return 0;
}
